<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <body>
        <ui:composition template="./../../template/main.xhtml">
            <ui:define name="content">
                <h1 class="title ui-widget-header ui-corner-all ">THỐNG KÊ DOANH THU BÁN HÀNG</h1>
                <p:growl id="messages"/>
                <h:form>
                    <p:panelGrid columns="4" style="margin: 20px auto">
                        <!-- Month -->
                        <p:outputLabel value="Tháng: "/>
                        <p:selectOneMenu value="#{revenueReportController.selectedMonth}">
                            <f:selectItem itemLabel="-- Chọn tháng --" itemValue=""/>
                            <f:selectItem itemLabel="1" itemValue="1"/>
                            <f:selectItem itemLabel="2" itemValue="2"/>
                            <f:selectItem itemLabel="3" itemValue="3"/>
                            <f:selectItem itemLabel="4" itemValue="4"/>
                            <f:selectItem itemLabel="5" itemValue="5"/>
                            <f:selectItem itemLabel="6" itemValue="6"/>
                            <f:selectItem itemLabel="7" itemValue="7"/>
                            <f:selectItem itemLabel="8" itemValue="8"/>
                            <f:selectItem itemLabel="9" itemValue="9"/>
                            <f:selectItem itemLabel="10" itemValue="10"/>
                            <f:selectItem itemLabel="11" itemValue="11"/>
                            <f:selectItem itemLabel="12" itemValue="12"/>
                        </p:selectOneMenu>
                        <!-- Year -->
                        <p:outputLabel value="Năm: "/>
                        <p:selectOneMenu value="#{revenueReportController.selectedYear}">
                            <f:selectItem itemLabel="-- Chọn năm --" itemValue=""/>
                            <f:selectItem itemLabel="2011" itemValue="2011"/>
                            <f:selectItem itemLabel="2012" itemValue="2012"/>
                            <f:selectItem itemLabel="2013" itemValue="2013"/>
                            <f:selectItem itemLabel="2014" itemValue="2014"/>
                            <f:selectItem itemLabel="2015" itemValue="2015"/>
                            <f:selectItem itemLabel="2016" itemValue="2016"/>
                            <f:selectItem itemLabel="2017" itemValue="2017"/>
                            <f:selectItem itemLabel="2018" itemValue="2018"/>
                            <f:selectItem itemLabel="2019" itemValue="2019"/>
                            <f:selectItem itemLabel="2020" itemValue="2020"/>
                        </p:selectOneMenu>
                        <!-- Actions -->
                        <f:facet name="footer">
                            <center>
                                <p:separator/>
                                <p:commandButton id="btnShow" actionListener="#{revenueReportController.updateDeliveryNoteRevenueList()}" update=":deliveryNoteRevenueForm" icon="ui-icon-check" title="Xem thống kê" value="Xem thống kê"/>
                            </center>
                        </f:facet>
                    </p:panelGrid>
                </h:form>
                <p:outputPanel deferred="true">
                    <p:dataTable style="text-align: center" id="deliveryNoteRevenueForm" var="deliveryNoteRevenue" value="#{revenueReportController.deliveryNoteRevenueList}" paginator="true" rows="20" 
                                 paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}" rowsPerPageTemplate="10,20,30" 
                                 emptyMessage="Không tìm thấy dữ liệu..." rendered="#{moduleController.isRendered(moduleController.colorDataTable)}">
                        <!-- Store -->
                        <p:column headerText="Chi nhánh">
                            <p:outputLabel value="#{deliveryNoteRevenue.storeName}"/>
                        </p:column>
                        <!-- Date -->
                        <p:column headerText="Ngày">
                            <p:outputLabel value="#{deliveryNoteRevenue.date}">
                                <f:convertDateTime pattern="dd/MM/yyyy"/>
                            </p:outputLabel>
                        </p:column>
                        <!-- Revenue -->
                        <p:column headerText="Tổng thu">
                            <p:outputLabel value="#{deliveryNoteRevenue.totalAmount}">
                                <f:convertNumber integerOnly="true"/>
                            </p:outputLabel>
                        </p:column>
                    </p:dataTable>
                </p:outputPanel>
            </ui:define>
        </ui:composition>
    </body>
</html>